[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
heapwalk() Walk Through the Heap
#include <alloc.h>
int heapwalk(hinfo);
struct heapinfo *hinfo; Heap info structure.
This function fills a heapinfo structure as follows:
struct heapinfo
{
void *ptr; // Address of this memory block.
unsigned int size; // Size in bytes.
int in_use; // In use flag.
};
The possible return values are:
_HEAPOK Heap is alright.
_HEAPEMPTY Heap is empty.
_HEAPEND End of the heap has been reached.
Returns: Greater than zero for success; negative otherwise.
-------------------------------- Example ---------------------------------
This example allocates, frees, and checks on a memory block.
#include <stdio.h>
#include <alloc.h>
int main( void )
{
struct heapinfo hinfo;
char *my_data;
my_data = malloc(1000);
free(my_data);
hinfo.ptr = NULL;
if(heapwalk(&hinfo) == _HEAPOK)
printf("Heap is alright.\n");
return 0;
}
See Also:
farheapwalk()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson